package com.wrupple.muba.catalogs.client.module;

import com.google.gwt.inject.client.AbstractGinModule;
import com.google.inject.Singleton;
import com.wrupple.muba.catalogs.client.CatalogFieldMap;
import com.wrupple.muba.catalogs.client.activity.process.CatalogTypeSelectionActivityProcess;
import com.wrupple.muba.catalogs.client.activity.process.CatalogTypeSelectionProcess;
import com.wrupple.muba.catalogs.client.activity.process.FilterSelectionProcess;
import com.wrupple.muba.catalogs.client.activity.process.GenericCatalogEditingProcess;
import com.wrupple.muba.catalogs.client.activity.process.GenericCatalogSelectionProcess;
import com.wrupple.muba.catalogs.client.activity.process.LoadSelectionProcessData;
import com.wrupple.muba.catalogs.client.activity.process.impl.CatalogTypeSelectionActivityProcessImpl;
import com.wrupple.muba.catalogs.client.activity.process.impl.CatalogTypeSelectionProcessImpl;
import com.wrupple.muba.catalogs.client.activity.process.impl.EditionActivityProcessImpl.ExitToBrowseActivity;
import com.wrupple.muba.catalogs.client.activity.process.impl.EditionActivityProcessImpl.ExitToDetailActivityImpl;
import com.wrupple.muba.catalogs.client.activity.process.impl.ForeignKeyFilterSelectionProcessImpl;
import com.wrupple.muba.catalogs.client.activity.process.impl.GenericCatalogEditingProcessImpl;
import com.wrupple.muba.catalogs.client.activity.process.impl.GenericCatalogSelectionProcessImpl;
import com.wrupple.muba.catalogs.client.activity.process.state.BrowsePlaceInterpret;
import com.wrupple.muba.catalogs.client.activity.process.state.BrowsePlaceInterpretImpl;
import com.wrupple.muba.catalogs.client.activity.process.state.CatalogSelectionPlaceInterpret;
import com.wrupple.muba.catalogs.client.activity.process.state.InteractionExitState;
import com.wrupple.muba.catalogs.client.activity.process.state.VoidInteractionExitState;
import com.wrupple.muba.catalogs.client.activity.process.state.impl.CatalogSelectionPlaceInterpretImpl;
import com.wrupple.muba.catalogs.client.activity.process.state.impl.LoadSelectionProcessDataImpl;
import com.wrupple.muba.catalogs.client.activity.process.task.CatalogTypeSelectionTask;
import com.wrupple.muba.catalogs.client.activity.process.task.FilterOptionSelectionState;
import com.wrupple.muba.catalogs.client.activity.process.task.GenericInteractionState;
import com.wrupple.muba.catalogs.client.activity.process.task.GenericSelectionState;
import com.wrupple.muba.catalogs.client.activity.process.task.impl.CatalogTypeSelectionTaskImpl;
import com.wrupple.muba.catalogs.client.activity.process.task.impl.FilterOptionSelectionStateImpl;
import com.wrupple.muba.catalogs.client.activity.process.task.impl.GenericInteractionStateImpl;
import com.wrupple.muba.catalogs.client.activity.process.task.impl.GenericSelectionStateImpl;
import com.wrupple.muba.catalogs.client.channels.CatalogDeletingChannel;
import com.wrupple.muba.catalogs.client.channels.CatalogDescriptionChannel;
import com.wrupple.muba.catalogs.client.channels.CatalogEditingChannel;
import com.wrupple.muba.catalogs.client.channels.CatalogListingChannel;
import com.wrupple.muba.catalogs.client.channels.CatalogReadingChannel;
import com.wrupple.muba.catalogs.client.channels.CatalogUploadActionUrlReadingChannel;
import com.wrupple.muba.catalogs.client.channels.impl.CatalogDeletingChannelImpl;
import com.wrupple.muba.catalogs.client.channels.impl.CatalogDescriptionChannelImpl;
import com.wrupple.muba.catalogs.client.channels.impl.CatalogEditingChannelImpl;
import com.wrupple.muba.catalogs.client.channels.impl.CatalogListingChannelImpl;
import com.wrupple.muba.catalogs.client.channels.impl.CatalogReadingChannelImpl;
import com.wrupple.muba.catalogs.client.channels.impl.CatalogUploadActionUrlReadingChannelImpl;
import com.wrupple.muba.catalogs.client.cms.service.impl.GenericCatalogManagerImpl;
import com.wrupple.muba.catalogs.client.module.services.CatalogDeletingSerializer;
import com.wrupple.muba.catalogs.client.module.services.CatalogSummarySerializer;
import com.wrupple.muba.catalogs.client.module.services.CatalogVegetateSerializer;
import com.wrupple.muba.catalogs.client.module.services.logic.CSVParser;
import com.wrupple.muba.catalogs.client.module.services.logic.CatalogDescriptionService;
import com.wrupple.muba.catalogs.client.module.services.logic.CatalogEntryAssembler;
import com.wrupple.muba.catalogs.client.module.services.logic.CatalogEntryJoiningStrategy;
import com.wrupple.muba.catalogs.client.module.services.logic.CatalogEntryKeyProvider;
import com.wrupple.muba.catalogs.client.module.services.logic.DeletingChannelSerializationService;
import com.wrupple.muba.catalogs.client.module.services.logic.EntryCreationService;
import com.wrupple.muba.catalogs.client.module.services.logic.EntryDeleteService;
import com.wrupple.muba.catalogs.client.module.services.logic.EntryRetrivingService;
import com.wrupple.muba.catalogs.client.module.services.logic.EntryUpdateService;
import com.wrupple.muba.catalogs.client.module.services.logic.FieldConversionStrategyProvider;
import com.wrupple.muba.catalogs.client.module.services.logic.FieldDescriptionService;
import com.wrupple.muba.catalogs.client.module.services.logic.GenericCatalogManager;
import com.wrupple.muba.catalogs.client.module.services.logic.GenericDataProvider;
import com.wrupple.muba.catalogs.client.module.services.logic.VoidCatalogDescriptorSerializer;
import com.wrupple.muba.catalogs.client.module.services.logic.VoidStringArraySerializationService;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.CSVParserImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.CatalogDeletingSerializerImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.CatalogDescriptionServiceImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.CatalogEntryAssemblerImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.CatalogEntryJoiningStrategyImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.CatalogEntryKeyProviderImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.CatalogStorageManager;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.CatalogSummarySerializerImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.CatalogVegetateSerializerImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.ClientSideFilterDataSerializationService;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.DeletingChannelSerializationServiceImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.EntryCreationServiceImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.EntryDeleteServiceImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.EntryProcessingServiceImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.EntryRetrivingServiceImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.EntryUpdateServiceImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.FieldConversionStrategyImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.FieldConversionStrategyProviderImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.FieldDescriptionServiceImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.VoidCatalogDescriptorSerializerImpl;
import com.wrupple.muba.catalogs.client.module.services.logic.impl.VoidStringArraySerializationServiceImpl;
import com.wrupple.muba.catalogs.client.module.services.presentation.CatalogIconDelegate;
import com.wrupple.muba.catalogs.client.module.services.presentation.GenericFieldFactory;
import com.wrupple.muba.catalogs.client.module.services.presentation.GenericTableInitializer;
import com.wrupple.muba.catalogs.client.module.services.presentation.impl.CatalogIconDelegateImpl;
import com.wrupple.muba.catalogs.client.module.services.presentation.impl.GenericCompositeDataProvider;
import com.wrupple.muba.catalogs.client.module.services.presentation.impl.GenericFieldFactoryImpl;
import com.wrupple.muba.catalogs.client.module.services.presentation.impl.GenericTableInitializerImpl;
import com.wrupple.muba.catalogs.client.view.BrowseView;
import com.wrupple.muba.catalogs.client.view.CatalogExportView;
import com.wrupple.muba.catalogs.client.view.FilterToolbar;
import com.wrupple.muba.catalogs.client.view.GenericBrowseView;
import com.wrupple.muba.catalogs.client.view.GenericCatalogEditor;
import com.wrupple.muba.catalogs.client.view.GenericDataDisplay;
import com.wrupple.muba.catalogs.client.view.GenericEditView;
import com.wrupple.muba.catalogs.client.view.ImportView;
import com.wrupple.muba.catalogs.client.view.impl.CatalogExportViewImpl;
import com.wrupple.muba.catalogs.client.view.impl.CatalogImportViewImpl;
import com.wrupple.muba.catalogs.client.view.impl.GenericBrowseViewImpl;
import com.wrupple.muba.catalogs.client.view.impl.GenericEditViewImpl;
import com.wrupple.muba.catalogs.client.widgets.FilterOptionSelectionView;
import com.wrupple.muba.catalogs.client.widgets.editors.composite.GenericCatalogEditorImpl;
import com.wrupple.muba.catalogs.client.widgets.impl.FilterOptionSelectionViewImpl;
import com.wrupple.muba.catalogs.client.widgets.impl.FilterToolbarImpl;
import com.wrupple.muba.catalogs.client.widgets.impl.GenericDataDisplayImpl;
import com.wrupple.muba.common.client.FieldConversionStrategy;
import com.wrupple.muba.common.shared.State.StorageManager;
import com.wrupple.muba.common.shared.services.CSVWriter;
import com.wrupple.muba.common.shared.services.impl.CSVWriterImpl;
import com.wrupple.vegetate.client.module.services.logic.EntryProcessingService;
import com.wrupple.vegetate.client.module.services.logic.FilterDataSerializationService;

public class CatalogModuleConfig extends AbstractGinModule {

	@Override
	protected void configure() {
		
		/*
		 * SERVICES
		 */
		//and other module servicesextends 
		bind(StorageManager.class).to(CatalogStorageManager.class);
		bind(CatalogEntryAssembler.class).to(CatalogEntryAssemblerImpl.class);
		bind(CatalogEntryJoiningStrategy.class).to(CatalogEntryJoiningStrategyImpl.class);
		//Data Type Metadata service
		bind(CatalogDescriptionService.class).to(CatalogDescriptionServiceImpl.class);
		//Data Type fields description service
		bind(CatalogSelectionPlaceInterpret.class).to(CatalogSelectionPlaceInterpretImpl.class);
		bind(FieldDescriptionService.class).to(FieldDescriptionServiceImpl.class);
		bind(EntryCreationService.class).to(EntryCreationServiceImpl.class);
		bind(EntryUpdateService.class).to(EntryUpdateServiceImpl.class);
		//bind(GenericDataProvider.class).to(GenericDataProviderImpl.class); <-- provides data without foreign joins
		bind(GenericDataProvider.class).to(GenericCompositeDataProvider.class);
		bind(EntryProcessingService.class).to(EntryProcessingServiceImpl.class);
		bind(EntryDeleteService.class).to(EntryDeleteServiceImpl.class);
		bind(EntryRetrivingService.class).to(EntryRetrivingServiceImpl.class);
		bind(CatalogIconDelegate.class).to(CatalogIconDelegateImpl.class);
		//knows how to initialize the cells of a generic catalog table
		bind(GenericTableInitializer.class).to(GenericTableInitializerImpl.class);
		//know how to parse CSV (the default export format)
		bind(CSVWriter.class).to(CSVWriterImpl.class);
		bind(CSVParser.class).to(CSVParserImpl.class);
		bind(FieldConversionStrategyProvider.class).to(FieldConversionStrategyProviderImpl.class);
		bind(FieldConversionStrategy.class).to(FieldConversionStrategyImpl.class);
		bind(FilterDataSerializationService.class).to(ClientSideFilterDataSerializationService.class);
		bind(CatalogVegetateSerializer.class).to(CatalogVegetateSerializerImpl.class);
		bind(CatalogSummarySerializer.class).to(CatalogSummarySerializerImpl.class);
		bind(CatalogDeletingSerializer.class).to(CatalogDeletingSerializerImpl.class);
		bind(VoidStringArraySerializationService.class).to(VoidStringArraySerializationServiceImpl.class);
		bind(VoidCatalogDescriptorSerializer.class).to(VoidCatalogDescriptorSerializerImpl.class);
		bind(DeletingChannelSerializationService.class).to(DeletingChannelSerializationServiceImpl.class);
		bind(CatalogEntryKeyProvider.class).to(CatalogEntryKeyProviderImpl.class);
		bind(GenericCatalogManager.class).to(GenericCatalogManagerImpl.class);
		/*
		 * Vegetate Channels
		 */
		bind(CatalogDeletingChannel.class).to(CatalogDeletingChannelImpl.class);
		bind(CatalogEditingChannel.class).to(CatalogEditingChannelImpl.class);
		bind(CatalogReadingChannel.class).to(CatalogReadingChannelImpl.class);
		bind(CatalogUploadActionUrlReadingChannel.class).to(CatalogUploadActionUrlReadingChannelImpl.class);
		bind(CatalogDescriptionChannel.class).to(CatalogDescriptionChannelImpl.class);
		bind(CatalogListingChannel.class).to(CatalogListingChannelImpl.class);
		/*
		 * PRESENTATION SERVICES
		 */
		/*
		 * Process and States
		 */
		bind(LoadSelectionProcessData.class).to(LoadSelectionProcessDataImpl.class);
		bind(CatalogTypeSelectionProcess.class).to(CatalogTypeSelectionProcessImpl.class);
		bind(FilterOptionSelectionState.class).to(FilterOptionSelectionStateImpl.class);
		bind(FilterSelectionProcess.class).to(ForeignKeyFilterSelectionProcessImpl.class);
		bind(CatalogTypeSelectionActivityProcess.class).to(CatalogTypeSelectionActivityProcessImpl.class);
		bind(GenericSelectionState.class).to(GenericSelectionStateImpl.class);
		bind(GenericInteractionState.class).to(GenericInteractionStateImpl.class);
		bind(BrowsePlaceInterpret.class).to(BrowsePlaceInterpretImpl.class);
		bind(GenericCatalogEditingProcess.class).to(GenericCatalogEditingProcessImpl.class);
		bind(GenericCatalogSelectionProcess.class).to(GenericCatalogSelectionProcessImpl.class);
		
		
		bind(InteractionExitState.class).to(ExitToDetailActivityImpl.class);
		bind(VoidInteractionExitState.class).to(ExitToBrowseActivity.class);
		// Dinamic Form generating
		bind(GenericFieldFactory.class).to(GenericFieldFactoryImpl.class);
		
		// dinamic view generation
		bind(GenericDataDisplay.class).to(GenericDataDisplayImpl.class);
		bind(FilterToolbar.class).to(FilterToolbarImpl.class);
		bind(GenericCatalogEditor.class).to(GenericCatalogEditorImpl.class);
		bind(GenericEditView.class).to(GenericEditViewImpl.class);
		bind(GenericBrowseView.class).to(GenericBrowseViewImpl.class);
		bind(BrowseView.class).to(GenericBrowseViewImpl.class);
		bind(CatalogFieldMap.class).in(Singleton.class);
		bind(CatalogExportView.class).to(CatalogExportViewImpl.class);
		bind(ImportView.class).to(CatalogImportViewImpl.class);
		bind(CatalogTypeSelectionTask.class).to(CatalogTypeSelectionTaskImpl.class);
		bind(FilterOptionSelectionView.class).to(FilterOptionSelectionViewImpl.class);
		
	}
	
	

}
